/**
 * 
 * PowerBar class
 * 
 * @author Andrew
 * @creator Calvin
 *
 */
public class PowerBar extends Object {

		private static double time;

	public PowerBar(double x, double y) {
		super(new Sprite("pb0.png"),x,y);
	}
	
	// Draws it depending on the time
	public void draw(Timer powerTimer) {
		double t = JGE.getVelocity((long) powerTimer.getDeltaTime());
		if(t/15*100 <= 2) super.sprite = new Sprite("pb0.png");
		else if(t/15*100 <= 10) super.sprite = new Sprite("pb1.png");
		else if(t/15*100 <= 20) super.sprite = new Sprite("pb2.png");
		else if(t/15*100 <= 20) super.sprite = new Sprite("pb3.png");
		else if(t/15*100 <= 30) super.sprite = new Sprite("pb4.png");
		else if(t/15*100 <= 40) super.sprite = new Sprite("pb5.png");
		else if(t/15*100 <= 50) super.sprite = new Sprite("pb6.png");
		else if(t/15*100 <= 60) super.sprite = new Sprite("pb7.png");
		else if(t/15*100 <= 70) super.sprite = new Sprite("pb8.png");
		else if(t/15*100 <= 80) super.sprite = new Sprite("pb9.png");
		else if(t/15*100 <= 90) super.sprite = new Sprite("pb10.png");
		else if(t/15*100 <= 100) super.sprite = new Sprite("pb11.png");
		else if(t/15*100 <= 110) super.sprite = new Sprite("pb10.png");
		else if(t/15*100 <= 120) super.sprite = new Sprite("pb9.png");
		else if(t/15*100 <= 130) super.sprite = new Sprite("pb8.png");
		else if(t/15*100 <= 140) super.sprite = new Sprite("pb7.png");
		else if(t/15*100 <= 150) super.sprite = new Sprite("pb6.png");
		else if(t/15*100 <= 160) super.sprite = new Sprite("pb5.png");
		else if(t/15*100 <= 170) super.sprite = new Sprite("pb4.png");
		else if(t/15*100 <= 180) super.sprite = new Sprite("pb3.png");
		else if(t/15*100 <= 190) super.sprite = new Sprite("pb2.png");
		else if(t/15*100 <= 200) super.sprite = new Sprite("pb1.png");
		else super.sprite = new Sprite("pb0.png");
		super.draw();
	}
	
	public static double velocity (Timer powerTimer, boolean space){

	if (powerTimer.getDeltaTime() >= 1500 && powerTimer.getDeltaTime() <= 3000){

	time = 1500 - (powerTimer.getDeltaTime() -1500);

	return time;

	}

	else if(powerTimer.getDeltaTime() > 3000) {

	powerTimer.reset();

	time = 0.0;

	return time;

	}

	else {

	time = powerTimer.getDeltaTime();

	return time;
	}

	}

	public static double gettime(){

	return time;

	}


	public static double getvel(ProjectileObject ball){

	  return ball.setVelocity(JGE.getVelocity(time));

	}


	

}
